package br.com.ep.generico.core;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;


public abstract class GenericService<T>  {

	//TODO forma de setar repository	
	protected JpaRepository<T, Integer> genericRepository;
		
	

	public List<T> find(String propertyValue){
		setGenericRepository();
		return null;
	}

	public List<T> findAll(){	
		setGenericRepository();
		return genericRepository.findAll();		
	}
	

	public T save(T entity){
		setGenericRepository();
		return genericRepository.save(entity);
	}
	


	public void delete(T entity){
		setGenericRepository();
		genericRepository.delete(entity);
	}

	public abstract T newInstance();
	
	public abstract void setGenericRepository();
}
